package com.tigerlee.stopmusic;

import java.util.Calendar;

public abstract class Clock {
	private long mSystemCurrentTime;
	private int mHour;
	private int mMinute;
	private int mSecond;
	
	public Clock() {
		this.mSystemCurrentTime = System.currentTimeMillis();
		setCurrentTime(mSystemCurrentTime);
	}
	public Clock(long systemCurrentTime) {
		this.mSystemCurrentTime = systemCurrentTime;
		setCurrentTime(systemCurrentTime);
	}
	
	public void setCurrentTime(long systemCurrentTime) {
		// Set Current time
		this.mSystemCurrentTime = systemCurrentTime;
		Calendar c = Calendar.getInstance();
		c.setTimeInMillis(systemCurrentTime);
		
		// Reset to currentTime to day, hour and second
		mHour = c.get(Calendar.HOUR_OF_DAY);
		mMinute = c.get(Calendar.MINUTE);
		mSecond = c.get(Calendar.SECOND);
	}
	public void setCurrentHour(int hour) {
		this.mHour = hour;
	}
	public void setCurrentMinute(int minute) {
		this.mMinute = minute;
	}
	public void setCurrentSecond(int second) {
		this.mSecond = second;
	}
	
	public long getCurrentTime() {
		return mSystemCurrentTime;
	}
	public int getCurrentHour() {
		return mHour;
	}
	public int getCurrentMinute() {
		return mMinute;
	}
	public int getCurrentSecond() {
		return mSecond;
	}
}
